#pragma once
#include "Callback.h"
#include "Profile.h"
#include <functional>
#include <stdio.h>
#include <string>
#include <vector>

typedef struct {
	int port_number;
	int baud_rate;
	uint8_t data_bits;
	uint8_t parity;
	uint8_t stop_bits;
	int pack_timeout;
	Callback<void, std::vector<char>> callback;
} uart_serial_port_t;

class IHardwareInterface {
public:
	virtual ~IHardwareInterface() = default;

	virtual bool onSerialData(uart_serial_port_t *uart_config) = 0;
	// 发送串口数据
	virtual bool writeSerial(int portNumber, char *data,
							 size_t length) = 0;

	// ===== GPIO 相关 =====
	// 读引脚
	virtual int readPin(int pinNumber) = 0;
	// 写引脚
	virtual bool writePin(int pinNumber, int value) = 0;
};
